
		<script>
	$(function() {
		$("#patient_id2").autocomplete({
			source: "<?php echo site_url()?>?c=search&m=patient",
			select: function(event, ui) {
                                $("#loaded_data").hide('slow');
				$("#searched_patient").val(ui.item.id);
                                $("#p_name").html(ui.item.value);
                                $("#p_code").html(ui.item.code);
                                load_patient_account(ui.item.id);
                                $("#printall").show();
			}
		});

      $("#total").click(function(){
    	  $.post("<?php echo site_url()?>/account/chceckups_total/",
   			   function(data){
   	                   
   				alert(data)
   			   });

          
      });


      $("#totaltotal").click(function(){
    	  $.post("<?php echo site_url()?>/account/chceckups_total/NULL/"+7+"/"+2010,
   			   function(data){
   	                   
   				alert(data)
   			   });

          
      });

     $("#printall").click(function(){
    	 window.open("<?php echo site_url()?>/account/print_account/"+$("#searched_patient").val(), '_blank', 'scrollbars=yes,status=yes,resizable=yes,screenx=0,screeny=0');
     })
   
    
      $("#printall").hide();
	});

   
      
    

	
        function load_patient_account(patient)
        {
            $('.p1').html('<center><br><br><br><img src=<?php echo base_url ()?>images/loading.gif></center>');
            $.post("<?php echo site_url()?>/account/chceckups_cost/"+patient,
		   function(data){
                     
			$('.p1').html(data);
		   });
            $("#loaded_data").show('slow');
        }


          

	</script>
	
	<br>
	<br>
	<br>
	<div>
	<br>
	<br>
	<br>

	
	<div>
		<input type="button" class='btn' alt="" value="Total" id='total'/>
		<input type="button" class='btn' alt="" value="Total++" id='totaltotal'/>
		</div>
		<div >&nbsp;</div>
		<label> Patient </label> <input type="text" id="patient_id2" />
		<input type="button" class='btn' alt="" value="Print all" id='printall'/>
		
                <form>

                    <input type="hidden" id="searched_patient" />

                </form>

    <div id="loaded_data" style="display: none">
    <div class="ui-widget">
        <div style="margin-top: 20px; padding: 0pt 0.7em;" class="ui-state-highlight ui-corner-all">
            <p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-person"></span>
                <strong><?php echo lang('menuitem_patient').' '.lang('form_label_name')?> : </strong>
                <span id="p_name"></span>
                <br>
                <span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-unlocked"></span>
                 <strong><?php echo lang('menuitem_patient').' '.lang('general_code')?> :</strong>
                 <span id="p_code"></span>
            </p>
        </div>
    </div>
    <br>
    </div>
    <div class="p1"></div>

	</div>